package com.iwish.server.util;

import java.nio.charset.Charset;

import org.apache.mina.util.Base64;



public class Base64Util {
	
	private static Base64 gen = new Base64();
	
	public static String encode(byte[] bytes)
	{
		return new String(gen.encode(bytes));
	}

	public static byte[] decode(String str)
	{
		return gen.decode(str.getBytes(Charset.forName("UTF-8")));		
	}
	
	public static void main(String[] args){
		System.out.println(Base64Util.encode("M3".getBytes()));
		System.out.println(Base64Util.encode("user@email.com".getBytes()));
		System.out.println(Base64Util.encode("123123".getBytes()));
		System.out.println(Base64Util.encode("user".getBytes()));
		System.out.println(Base64Util.encode("1".getBytes()));
		System.out.println(Base64Util.encode("asdasddadsd".getBytes()));
	}
}
